/**
 * 
 */
package mdb.com.vn.model;

/**
 * @author tu.dod
 *
 */
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

import java.io.Serializable;
import java.util.Date;

/**
 * This class is an abstract super class for all Entity classes in the
 * application. This class defines variables which are common for all entity
 * classes.
 */
@MappedSuperclass
public abstract class AuditPojo implements Serializable {

    private static final long serialVersionUID = 4971533902749753146L;
    @Column(name = "VERSION_NUM")
    @Version
    protected Long version;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "DATE_CREATED")
    protected Date dateCreated;

    @Column(name = "CREATED_BY", length = 50)
    protected String createdBy;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "DATE_UPDATED")
    protected Date dateUpdated;

    @Column(name = "UPDATED_BY", length = 50)
    protected String updatedBy;

    /**
     * Get the date created for this entity. The date created is the timestamp
     * for when the entity was created.
     *
     * @return time stamp for creation date & time
     */
    public Date getDateCreated() {
        return dateCreated;
    }

    /**
     * Set the date created for the entity. This method should be called
     * automatically and not by the end user code
     *
     * @param dateCreated date created
     */
    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    /**
     * Get the user who created this entity.
     *
     * @return user who created the entity
     */
    public String getCreatedBy() {
        return createdBy;
    }

    /**
     * Set the user who created the entity. This method should be called
     * automatically and not by the end user code
     *
     * @param createdBy user who created the entity
     */
    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    /**
     * Get the date of the last update to the entity.
     * The date updated is the time stamp for when the entity
     * last updated.
     *
     * @return date updated
     */
    public Date getDateUpdated() {
        return dateUpdated;
    }

    /**
     * Set the last update date for the entity. This method should be called
     * automatically and not by the end user code.
     *
     * @param dateUpdated date updated
     */
    public void setDateUpdated(Date dateUpdated) {
        this.dateUpdated = dateUpdated;
    }


    /**
     * Get the user who last updated this entity.
     *
     * @return user who last updated this entity
     */
    public String getUpdatedBy() {
        return updatedBy;
    }

    /**
     * Set the user who last updated the entity. This method should be called
     * automatically and not by the end user code.
     *
     * @param updatedBy user who last updated this entity.
     */
    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    /**
     * Get the concurrency version number for this entity. The concurrency
     * version is a number which is used for optimistic locking in the database.
     *
     * @return current consistency version
     */
    public Long getVersion() {
        return version;
    }

	@Override
    public int hashCode() {
        return 1;
    }

    @Override
	public boolean equals(Object obj) {
        return (obj != null);
	}

}
